

#import "ProspectusAppDelagate.h"
#import "ListofDepartmentsViewController.h"
#import "FrontViewController.h"
#import "DataAccess.h"


@implementation ProspectusAppDelagate

@synthesize window;
@synthesize navigationController;


#pragma mark -
#pragma mark Application lifecycle

- (void)applicationDidFinishLaunching:(UIApplication *)application {


	//open sql store
	[DataAccess initializeDatabase];


	//show front page
	FrontViewController *frontViewController = 
		[[FrontViewController alloc] initWithNibName:@"FrontView" bundle:nil] ;

	[navigationController pushViewController:frontViewController animated:YES];
	[frontViewController release];
	///
	// Configure and show the window
	[window addSubview:[navigationController view]];
	[window makeKeyAndVisible];

}


/**
 applicationWillTerminate: 
 */
- (void)applicationWillTerminate:(UIApplication *)application {
	[DataAccess closeDatabase];
	
	
}




#pragma mark -
#pragma mark Application's documents directory

/**
 Returns the path to the application's documents directory.
 */
- (NSString *)applicationDocumentsDirectory {
	
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
    return basePath;
}


#pragma mark -
#pragma mark Memory management

- (void)dealloc {
	
    
	[navigationController release];
	[window release];
	[super dealloc];
}


@end
